//
//  RestaurantViewModel.m
//  Park
//
//  Created by 123456 on 2017/12/8.
//  Copyright © 2017年 YTYangK. All rights reserved.
//

#import "RestaurantViewModel.h"

@implementation RestaurantViewModel


+(void)requestWithUrlForRestaurant:(id)obj andParam:(NSDictionary *)param success:(void(^)(NSMutableArray *model))success failure:(void(^)(NSString *error))failure{
    
    
    [NetRequestClss requestWithUrl:@"app/restaurant.do?" requestWithParameters:param method:NetMethodPOST returnSuccess:^(id objs, int status, NSString *mag) {
        
        NSLog(@"请求返回 ===== %@",objs);
        
        if ([objs[@"result"] isEqualToString:@"success"]) {
            
            success(objs[@"body"][@"shopsDp"]);
            
        }else{
            
            failure(objs[@"msg"]);
            
        }
        
        
    } returnError:^(NSString *err) {
        failure(err);
        
    }];
    
}


+(void)requestWithUrlForRestaurantSubmit:(id)obj andParam:(NSDictionary *)param success:(void(^)(NSMutableArray *model))success failure:(void(^)(NSString *error))failure{
    
    [NetRequestClss requestWithUrl:@"app/restaurantOrder.do?" requestWithParameters:param method:NetMethodPOST returnSuccess:^(id objs, int status, NSString *mag) {
        
        NSLog(@"请求返回1 ===== %@",objs);
        
        if ([objs[@"result"] isEqualToString:@"success"]) {
            
            success(objs[@"body"][@"shopsDp"]);
            
        }else{
            
            failure(objs[@"msg"]);
            
        }
        
        
    } returnError:^(NSString *err) {
        failure(err);
        
    }];

}


+(void)requestWithUrlForAllOrdersInTheRestaurant:(id)obj andParam:(NSDictionary *)param success:(void(^)(NSMutableArray *model))success failure:(void(^)(NSString *error))failure{
    
    
    [NetRequestClss requestWithUrl:@"app/findRestaurantOrder.do?" requestWithParameters:param method:NetMethodPOST returnSuccess:^(id objs, int status, NSString *mag) {

        
        NSLog(@"请求返回1 ===== %@",objs);

    if ([objs[@"result"] isEqualToString:@"success"]) {
        
        success(objs[@"body"][@"reserveDps"]);
        
    }else{
        
        failure(objs[@"msg"]);
        
    }
    
    
} returnError:^(NSString *err) {
    failure(err);
    
}];

    
    
}

+(void)requestWithUrlForConfirmOrder:(id)obj andParam:(NSDictionary *)param success:(void(^)(NSMutableArray *model))success failure:(void(^)(NSString *error))failure{
    
    
    [NetRequestClss requestWithUrl:@"app/restaurantAffirm.do?" requestWithParameters:param method:NetMethodPOST returnSuccess:^(id objs, int status, NSString *mag) {
        
        
        NSLog(@"请求返回1 ===== %@",objs);
        
        if ([objs[@"result"] isEqualToString:@"success"]) {
            
            success(objs[@"body"][@"reserveDps"]);
            
        }else{
            
            failure(objs[@"msg"]);
            
        }
        
        
    } returnError:^(NSString *err) {
        failure(err);
        
    }];

    
    
    
}



@end
